/**
 * @Description
 * @author 0155887 赵开兰
 * @create 2018-05-06 9:55
 **/
package com.academic_system.mapper;
import com.academic_system.model.StuApply;
import org.apache.ibatis.jdbc.SQL;

/**
 * @className PartyApplySqlProvider
 * @Description：多条件动态查询
 **/
public class PartyApplySqlProvider {
    public String query(StuApply stuApply) {
        StringBuilder sql = new StringBuilder("select * from stu_apply where 1=1");
        if (stuApply.getStuNum() != null) {
            sql.append(" and stu_num=#{stuNum}");
        }
        if (stuApply.getStuName() != null && !("".equals(stuApply.getStuName()))) {
            sql.append(" and stu_name=#{stuName}");
        }
        if (stuApply.getPartyOrganizationNum() != null) {
            sql.append(" and party_organization_num=#{partyOrganizationNum}");
        }
        return sql.toString();
    }

 /*  public String queryPartyApplyByConditions(final StuApply stuApply) {
        return new SQL() {{
            SELECT("stu_num,stu_name,party_organization_num");
            FROM("stu_apply");
            if (stuApply.getStuNum() != null) {
                WHERE("stu_num=#{stuNum}");
            }
            if (stuApply.getStuName()!= null) {
                WHERE("stu_name=#{stuName}}");
            }
            if (stuApply.getPartyOrganizationNum()!= null) {
                WHERE("party_organization_num=#{partyOrganizationNum}}");
            }
           *//*if (dorStuTerm.getApplyDate() != null) {
                WHERE("apply_date=#{applyDate}");
            }*//*

        }}.toString();
    }*/
}
